<template>
	<view>
		<view class="ffffff radius mainpadding margin_top" v-for="item in list.data" :key="item.id"
			@click="jumpdetail('/pages_shouye/mendianxq?id=',item.manystoreshop.id)">
			<view class="flexleft">
				<image class="listleftimg radius margin_right2" :src="item.manystoreshop.logo_text"></image>
				<view class="flexcolumnbet" style="height: 140rpx;">
					<view class="titletext hei_text bold">{{item.manystoreshop.name}}</view>
					<view class="flexleft">
						<u-icon name="man-add" color="#ff9341" size="16"></u-icon>
						<view class="xiaohuang margin_right margin_left1 strongtext">粉丝{{item.manystoreshop.gz_num}}个
						</view>
						<u-icon name="eye" color="#999" size="16"></u-icon>
						<view class="xiaohui margin_right margin_left1 strongtext">浏览{{item.manystoreshop.view_num}}次
						</view>
					</view>
				</view>
			</view>
			<view class="flexbetween margin_top2">
				<view class="flexleft">
					<u-icon name="map" color="#ff9341" size="18"></u-icon>
					<view class="xiaohui margin_left1 main_size yhxk" style="width: 500rpx;">
						{{item.manystoreshop.address}}
					</view>
				</view>
				<view class="xiaohuang main_size">{{returnKmUnit(Number(item.distance))}}</view>
			</view>
		</view>
	</view>
</template>

<script>
	const httpRequest = require("@/common/httpRequest.js")
	export default {
		data() {
			return {
				page: 1,
				limit: 12,
				list: {
					data: []
				},
				lat: "",
				lng: "",
				cityid: "",
			}
		},
		onLoad() {
			let storagecity = uni.getStorageSync("storagecity") || null
			if (storagecity) {
				this.lat = storagecity.latitude
				this.lng = storagecity.longitude
				this.cityid = storagecity.cityid
			}
		},
		onShow() {
			this.init()
		},
		methods: {
			jumpdetail(url, id) {
				uni.navigateTo({
					url: url + id
				})
			},
			init(isPage, page) {
				let _this = this
				httpRequest.request('/api/shopcl/myCollectShop', 'GET', {
					page: page || 1,
					limit: _this.limit,
					lat: this.lat,
					lng: this.lng
				}).then(res => {
					if (res.code == 1) {
						let resList = res.data;
						let dataList = _this.list;
						if (isPage == true) {
							_this.list.data = dataList.data.concat(resList.data);
						} else {
							this.list = res.data
							_this.list.data = resList.data;
						}
					}
				}).catch(err => {
					httpRequest.toast(err.msg);
				})
			},
			onReachBottom() {
				let _this = this;
				let list = _this.list;
				let page = _this.page;
				if (list.last_page <= page) {
					return false;
				}
				page++;
				_this.page = page;
				_this.init(true, page);
			},
		}
	}
</script>

<style>

</style>